package cn.dxc.demo.service.impl;


import cn.dxc.demo.entity.FeedBack;
import cn.dxc.demo.mapper.BackMapper;
import cn.dxc.demo.service.IBackService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;

@Service
public class BackServiceImpl extends ServiceImpl<BackMapper, FeedBack> implements IBackService {

    @Autowired
    private BackMapper backMapper;

    @Override
    public Integer insertMessage(FeedBack feedBack) {
        final int flag = backMapper.insert(feedBack);
        return flag>0 ? feedBack.getUid():0;
    }

    @Override
    public Integer updateUserEmail(Integer uid, String email) {
        final HashMap<String, Object> map = new HashMap<>();
        map.put("uid",uid);
        map.put("email",email);
        final Integer integer = backMapper.updateUserEmail(map);
        return integer > 0 ? 1:0;
    }


}
